package t4;

import t4bean.PurchaseOrderBean;
import t4bean.SalesvolumeRecordBean;
import t4bean.StallBean;
import t4bean.StockBean;

/**
 * 显示所有水果库存，售价，进价，累计销售数量、金额，累计进货数量、金额
 *
 */
public class ShowFruit {
	public void showFruit(StallBean stall) {
		for (StockBean stock : stall.getStockList()) {
			System.out.println("名字：" + stock.getFruit().getName());
			System.out.println("库存：" + stock.getStockNumber() + "个");
			System.out.println("售价" + stock.getFruit().getPrice());
			Integer all = 0;
			Integer allDiscount = 0;
			for (SalesvolumeRecordBean sr : stall.getSalList()) {
				if (sr.getFruit().getName().equals(stock.getFruit().getName())) {
					all = all + sr.getSalesVolume();
					allDiscount = allDiscount + sr.getSalesVolume() * sr.getDiscount() / 10;
				}
			}
			System.out.println("累计销售数量" + all);
			System.out.println("累计销售金额" + allDiscount * stock.getFruit().getPrice());
			System.out.println("进价" + stock.getFruit().getCost());

			for (PurchaseOrderBean po : stall.getPurList()) {
				if (po.getFruit().getName().equals(stock.getFruit().getName())) {
					System.out.println("累计进货数量" + po.getPurchaseQuantity());
					System.out.println("累计进货金额" + po.getPurchaseQuantity() * stock.getFruit().getCost());
				}
			}
			System.out.println();
		}
	}
}
